import datetime
from settings.publicvar import Base
from sqlalchemy.orm import Mapped, mapped_column, relationship
from sqlalchemy import  ForeignKey
from typing_extensions import Annotated

from views.person.model.person import PersonBaseInfo

int_pk = Annotated[int,mapped_column(primary_key=True)]
date_set = Annotated[datetime.date,mapped_column(nullable=True)]

class FurtherStudy(Base):
    __tablename__ = 'furtherstudy'

    id: Mapped[int_pk]
    name_id: Mapped[int] = mapped_column(ForeignKey('personbaseinfo.id'))
    start_date:Mapped[date_set]
    end_date:Mapped[date_set]
    school:Mapped[str]
    mark: Mapped[str]

    personbase: Mapped[PersonBaseInfo] = relationship(lazy=False, backref='furtherstudys')
